package com.glhtgyxy.biyesheji.Controller;


import com.glhtgyxy.biyesheji.Pojo.evaluate;
import com.glhtgyxy.biyesheji.Pojo.merchant;
import com.glhtgyxy.biyesheji.Pojo.user;
import com.glhtgyxy.biyesheji.Service.dlzcService;
import com.glhtgyxy.biyesheji.Service.evaluateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;

@Controller
@RequestMapping("dlzc")
@CrossOrigin(origins = "*")
public class dlzcController {

    @Autowired
    dlzcService service;

    @ResponseBody
    @RequestMapping("dlzc/{useraccount}/{password}")
    public ArrayList<user> dlzc(@PathVariable String useraccount, @PathVariable String password){
        System.out.println("登陆注册方法执行中，账号:"+useraccount+"密码："+password);
        ArrayList<user> user = service.dlzc(useraccount,password);
        System.out.println("查询结束，返回："+user);
        return user;
    }

    @ResponseBody
    @RequestMapping("idfindusername/{id}")
    public String idfindusername(@PathVariable int id){
        System.out.println("id查找账户名:"+id);
        String  username = service.idfindusername(id);
        System.out.println("查询结束，返回："+username);
        return username;
    }

    @ResponseBody
    @RequestMapping("idfindmerchantname/{id}")
    public String idfindmerchantname(@PathVariable int id){
        System.out.println("id查找商户名:"+id);
        String  username = service.idfindmerchant(id);
        System.out.println("查询结束，返回："+username);
        return username;
    }


    @ResponseBody
    @RequestMapping("sjdl/{account}/{password}")
    public ArrayList<merchant> sjdl(@PathVariable String account, @PathVariable String password){
        System.out.println("商家登录中，账号：:"+account+"密码:"+password);
        ArrayList<merchant> merchants = service.sjdl(account,password);
        System.out.println("登录结束，返回："+merchants);
        return merchants;
    }



}
